<?php
ini_set('display_errors', 0);
error_reporting(E_ALL);

// Epiphany Development, Inc. All rights reserved
// secureForm.php Live code
// Data maintained via admin user
// Build History:
// 30JAN03 Sparky  initial build
//setup for mysql access
//get env sent from apache
global $_REQUEST;

//DEMO MODE 
$DEBUG = $_REQUEST["debug"];
//$DEBUG = "y";
//global $HTTP_COOKIE_VARS, $_REQUEST, $HTTP_GET_VARS;
if ($DEBUG)
    while (list($val, $key) = each($_REQUEST)) {
        echo "$val=>$key<BR>\n";
    }

//if ( $HTTP_GET_VARS["payID"] == NULL ) {  ****not used in this app yet ***
$PAYID = $_REQUEST["payID"];
//} else {
//  $PAYID = $HTTP_GET_VARS["payID"]; //programX provided from register.php
//  $NUMATTENDING = $HTTP_GET_VARS["numAttending"]; //numAttending provided from register.php
//}
$SUBMIT = $_REQUEST["Submit"];

//check required fields and return if not populated
//This is done in the html file -- client side.
// setup for database reads
$db = new ps_DB;

// setup maintained fields
$dt = date("Y-m-d H:i:s");

// retrieve payment data saved so far
/*
  if ($PAYID != "") {
  $q  = "SELECT * ";
  $q .= "  FROM newPay ";
  $q .= " WHERE payID='$PAYID' ";
  if ($DEBUG) echo "BEGIN:: $q<BR>";
  $db->query($q);
  $status = $db->next_record();
  $ccAMT=$db->f("amount");
  $COMPANY=$db->f("company");
  }
 */

//Defaults
$DESCRIPTION = "Epiphany Development edSecurePay";
$METADATA = "edSecurePay, authorize.net, epiphanydevelopment, epiphanydev";
$HDIMAGE = "";
$HD_BGIMAGE = "";
$BGIMAGE = "";
global $paypal; 
?>
<form name="pay" onsubmit="return isReady();" action='' method='post'>
    <div class="body home" style="background: url('/<?php echo $_Q_page ?>images/globe_bg.gif') no-repeat scroll -220% -290% transparent ">
        
        <div class="main">
            <div class="left">
                <div class="main"><a href="http://www.epiphanydev.com/"><img id="home" src="/<?php echo $_Q_page ?>images/home.png" alt="Home" /></a></div>
				<script>
					$('img#home').hover(function() {
					$(this).attr("src","<?php echo $_Q_page ?>images/home_o.png");
							}, function() {
					$(this).attr("src","<?php echo $_Q_page ?>images/home.png");
					});
				</script>
				<div id="paypal-return-<?php echo (isset($paypal->_error))? ($paypal->_error? "failure":(isset($_REQUEST['cancel'])?"canceled":($paypal->Response['ACK'] == "Success"?"success":""))):"" ?>">
					<?php echo (isset($paypal->_error))? ($paypal->_error? "Paypal Error : " . $paypal->_error_long_message : (isset($_REQUEST['cancel'])?"Payment has been Canceled":($paypal->Response['ACK'] == "Success"?"Successfull Thank You for your Payment":""))):"" ?>
				</div>
            </div> 
            <div class="right">
				<pre style="margin-bottom: 0; margin-top: 9px;">
If you need to contact us just call <span CLASS="plain12">251.433.3235 </span>
for assistance. Please fill out this 
form and press the Submit Payment button.
<strong><em>* required field </em></strong>
                </pre>
                <fieldset style="background: url('<?php echo $_Q_page ?>images/col_bg.gif') repeat-y">
                    <legend><strong>Information</strong></legend>
                    <table style="width: 100%;" cellspacing="0" cellpadding="2" border="0">
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>First Name:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <input class=myform maxLength=255 size=25 name=firstname value="<? echo $_REQUEST["firstname"]; ?>" /> 
                                <span class=required>*</span> 
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>Last Name:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <input class=myform maxLength=255 size=25 name=lastname value="<? echo $_REQUEST["lastname"]; ?>" /> 
                                <span class=required>*</span> 
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>E-mail Address:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <input class=myform maxLength=255 size=25 name=email value="<? echo $_REQUEST["email"]; ?>" /> 
                                <span class=required>*</span> 
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right width="34%" 
                                height=30><b>Website:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30><input 
                                    class=myform maxLength=255 size=25 value="http://"
                                    name=website value="<?
                                    if ($_REQUEST["website"] != "") {
                                        echo $_REQUEST["website"];
                                    } else {
                                        echo "http://";
                                    }
                                    ?>"> 
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>Address:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <input class=myform maxLength=255 size=25 name=address value="<? echo $_REQUEST["address"]; ?>" /> 
                                <span class=required>*</span> 
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>City:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <input class=myform maxLength=255 size=25 name=city value="<? echo $_REQUEST["city"]; ?>" /> 
                                <span class=required>*</span> 
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>State:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <!--<input class=myform maxLength=255 size=25 name=state value="<? echo $_REQUEST["state"]; ?>" /> -->
                                <select id="state" size="1" name="state" class="inputbox">
                                    <option value=""> -= Select =-</option>
                                    <option selected="selected" value="AL">Alabama</option>
                                    <option value="AK">Alaska</option>
                                    <option value="AZ">Arizona</option>
                                    <option value="AR">Arkansas</option>
                                    <option value="CA">California</option>
                                    <option value="CO">Colorado</option>
                                    <option value="CT">Connecticut</option>
                                    <option value="DE">Delaware</option>
                                    <option value="DC">District Of Columbia</option>
                                    <option value="FL">Florida</option>
                                    <option value="GA">Georgia</option>
                                    <option value="HI">Hawaii</option>
                                    <option value="ID">Idaho</option>
                                    <option value="IL">Illinois</option>
                                    <option value="IN">Indiana</option>
                                    <option value="IA">Iowa</option>
                                    <option value="KS">Kansas</option>
                                    <option value="KY">Kentucky</option>
                                    <option value="LA">Louisiana</option>
                                    <option value="ME">Maine</option>
                                    <option value="MD">Maryland</option>
                                    <option value="MA">Massachusetts</option>
                                    <option value="MI">Michigan</option>
                                    <option value="MN">Minnesota</option>
                                    <option value="MS">Mississippi</option>
                                    <option value="MO">Missouri</option>
                                    <option value="MT">Montana</option>
                                    <option value="NE">Nebraska</option>
                                    <option value="NV">Nevada</option>
                                    <option value="NH">New Hampshire</option>
                                    <option value="NJ">New Jersey</option>
                                    <option value="NM">New Mexico</option>
                                    <option value="NY">New York</option>
                                    <option value="NC">North Carolina</option>
                                    <option value="ND">North Dakota</option>
                                    <option value="OH">Ohio</option>
                                    <option value="OK">Oklahoma</option>
                                    <option value="OR">Oregon</option>
                                    <option value="PA">Pennsylvania</option>
                                    <option value="RI">Rhode Island</option>
                                    <option value="SC">South Carolina</option>
                                    <option value="SD">South Dakota</option>
                                    <option value="TN">Tennessee</option>
                                    <option value="TX">Texas</option>
                                    <option value="UT">Utah</option>
                                    <option value="VT">Vermont</option>
                                    <option value="VA">Virginia</option>
                                    <option value="WA">Washington</option>
                                    <option value="WV">West Virginia</option>
                                    <option value="WI">Wisconsin</option>
                                    <option value="WY">Wyoming</option>
                                </select>
                                <span class=required>*</span> 
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>Zip:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <input class=myform maxLength=255 size=25 name=zip value="<? echo $_REQUEST["zip"]; ?>" /> 
                                <span class=required>*</span> 
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>Phone:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <input class=myform maxLength=255 size=25 name=phone value="<? echo $_REQUEST["phone"]; ?>" /> 
                                <span class=required>*</span> 
                            </td>
                        </tr>
                        <!--
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>Invoice Number:</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <input class=myform maxLength=11 size=11 name=invoiceNumber value="<? echo $_REQUEST["invoiceNumber"]; ?>">
                            </td>
                        </tr>
                        -->
                        <tr class=plain12>
                            <td align=right width="34%" height=30>
                                <b>Payment Type:&nbsp;</b>
                            </td>
                            <td vAlign=top width="66%" height=30>
                                <select class=myform name=category> 
                                    <?
                                    // display all possible categories with correct one selected
                                    $o = array("--Please Select--", "Corporate Identity", "Online Marketing", "Website Development", "Collateral Materials", "Public Relations ", "Brand Development", "Advertising", "Marketing Strategy", "Event Management", "Media Planning & Negotiation");
                                    $i = 0;
                                    while ($o[$i]) {
                                        if ($_REQUEST["category"] == $o[$i])
                                            $S = " SELECTED";
                                        else
                                            $S="";
                                        echo "<option" . $S . " value='$o[$i]'>" . $o[$i] . "</option>\n";
                                        $i++;
                                    }
                                    ?>
                                </select>                            
                                <span class=required>*</span>
                            </td>
                        </tr>
                        <tr class=plain12>
                            <td align=right><b>Payment Amount:</b></td>
                            <td align=left>
                                <input class=myform maxLength=10 size=8 name=amount value="<? echo $_REQUEST["amount"]; ?>"> 
                                <span class=required>*</span><BR><font size=-1>(Example: 100 -or- 100.00)</font>
                            </td>
                        </tr>
                    </table>
                </fieldset>
                <fieldset style="background: url('<?php echo $_Q_page ?>images/col_bg.gif') repeat-y">
                    <legend><strong>PayPal</strong></legend>
                    <table width="100%" cellspacing="0" cellpadding="2" border="0">
                        <tbody>
                            <tr>
                                <td>
                                    <input type="hidden" value="" name="payment_method_ppex" id="paypalExpress_ecm">
                                    <input type="radio" id="paytype_2" value="2" name="paytype" id="paypalExpressID_ecm" />
                                    <img for="paytype_2" border="0" style="cursor:pointer;" alt="PayPal Checkout Available" src="/<?php echo $_Q_page; ?>images/paypal.png" id="paypalLogo" />
                                </td>
                            </tr>
                        </tbody></table>
                </fieldset>
                <fieldset style="background: url('<?php echo $_Q_page ?>images/col_bg.gif') repeat-y">
                    <legend><strong>Credit Card Payment</strong></legend>
                    <table width="100%" cellspacing="0" cellpadding="2" border="0">
                        <tbody><tr>
                                <td colspan="2">
                                    <input type="radio" checked="checked" value="1" id="paytype_1" name="paytype" />
                                    <label for="paytype_1">PayPal Pro API</label><br>		        
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2"><strong>&nbsp;</strong></td>
                            </tr>
                            <tr>
                                <td width="10%" nowrap="" align="right">Credit Card Type:</td>
                                <td>
                                    <select size="1" name="cardType" class="inputbox">
                                        <option value="VISA">Visa</option>
                                        <option value="MC">MasterCard</option>
                                    </select>                        
                                </td>
                            </tr>
                            <tr valign="top">
                                <td width="10%" nowrap="" align="right">
                                    <label for="order_payment_name">Name On Card:</label>
                                </td>
                                <td>
                                    <input type="text" autocomplete="off" value="" name="cardName" id="order_payment_name" class="inputbox">
                                </td>
                            </tr>
                            <tr valign="top">
                                <td width="10%" nowrap="" align="right">
                                    <label for="order_payment_number">Credit Card Number:</label>
                                </td>
                                <td>
                                    <input type="text" autocomplete="off" value="" name="cardNumber" id="order_payment_number" class="inputbox">
                                </td>
                            </tr>
                            <tr valign="top">
                                <td width="10%" nowrap="" align="right">
                                    <label for="credit_card_code">
                                        <span>Credit Card Security Code</span>:
                                    </label>
                                </td>		        		
                                <td>
                                    <input type="text" autocomplete="off" value="" name="cardSecurityNumber" id="credit_card_code" class="inputbox">

                                </td>
                            </tr>
                            <tr>
                                <td width="10%" nowrap="" align="right">Expiration Date:</td>
                                <td>
                                    <select size="1" name="month" class="inputbox required">
                                        <option value="0">Month</option>
                                        <option value="01">January</option>
                                        <option value="02">February</option>
                                        <option value="03">March</option>
                                        <option value="04">April</option>
                                        <option value="05">May</option>
                                        <option value="06">June</option>
                                        <option value="07">July</option>
                                        <option value="08">August</option>
                                        <option selected="selected" value="09">September</option>
                                        <option value="10">October</option>
                                        <option value="11">November</option>
                                        <option value="12">December</option>
                                    </select>
                                    /
                                    <select size="1" name="year" class="inputbox required">
                                        <option value="2011">2011</option>
                                        <option value="2012">2012</option>
                                        <option value="2013">2013</option>
                                        <option value="2014">2014</option>
                                        <option value="2015">2015</option>
                                        <option value="2016">2016</option>
                                        <option value="2017">2017</option>
                                        <option value="2018">2018</option>
                                    </select>
                                </td>
                            </tr>
                        </tbody></table>
                </fieldset>
            </div>
            <div class="submitbox"><input type="Submit" name="Submit" value="Submit Payment" class="myform"/></div>
        </div>
    </div>
</form>